package com.shitou.shitouorder.controller;

import com.shitou.shitoucommons.utils.PageUtils;
import com.shitou.shitoucommons.utils.RespBean;
import com.shitou.shitouorder.entity.PaymentInfoEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import com.shitou.shitouorder.service.PaymentInfoService;

import java.util.Arrays;
import java.util.Map;


/**
 * 支付信息表
 *
 * @author shitouren
 * @email 3076767823@qq.com
 * @date 2023-03-21 16:29:51
 */
@RestController
@RequestMapping("shitouorder/paymentinfo")
public class PaymentInfoController {
    @Autowired
    private PaymentInfoService paymentInfoService;


    /**
     * 列表
     */
    @RequestMapping("/list")
    public RespBean list(@RequestParam Map<String, Object> params){
        PageUtils page = paymentInfoService.queryPage(params);

        return RespBean.success().put("page", page);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public RespBean info(@PathVariable("id") Long id){
        PaymentInfoEntity paymentInfo = paymentInfoService.getById(id);

        return RespBean.success().put("paymentInfo", paymentInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public RespBean save(@RequestBody PaymentInfoEntity paymentInfo){
        paymentInfoService.save(paymentInfo);

        return RespBean.success();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public RespBean update(@RequestBody PaymentInfoEntity paymentInfo){
        paymentInfoService.updateById(paymentInfo);

        return RespBean.success();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public RespBean delete(@RequestBody Long[] ids){
        paymentInfoService.removeByIds(Arrays.asList(ids));

        return RespBean.success();
    }



}
